home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #############################################################################
- #
- # Program: splitmail
- # Usage: splitmail directory mailaddress
- # Example: splitmail /LocalApps jasmerb@ohsu.edu
- #
- # Misc: you can use any pathname (doesn't have to be a full pathname), but
- # you might want to avoid using '.' and '..' for the directory as you
- # will send the file '..tar.Z' or '...tar.Z' which is kind of screwy.
- #
- # you can alter the size of each piece of mail with the split -<N> flag
- # 1500 is about 90K, 4000 would be about 240K, etc.
- #############################################################################
-
- SPLITDIR=/tmp/splitmaildir$$
- DIRNAME=`basename $1`
- UUFILE=
-
- if [ $# != 2 ] ; then
- echo "usage: splitmail directory mailaddress"
- exit 1
- else
- if [ -d $1 ] ; then
- ZFILE=/tmp/splitmail$$.gtar.Z
- UUFILE=$ZFILE.uu
- echo "gnutar cf - $DIRNAME | compress -c | uuencode $ZFILE > $UUFILE"
- gnutar cf - $DIRNAME | compress -c | uuencode $ZFILE > $UUFILE
- else
- ZFILE=/tmp/splitmail$$.Z
- UUFILE=$ZFILE.uu
- echo "compress -c $DIRNAME | uuencode $ZFILE > $UUFILE"
- compress -c $DIRNAME | uuencode $ZFILE > $UUFILE
- fi
- mkdirs $SPLITDIR
- cd $SPLITDIR
- echo "splitting"
- split -1500 ../`basename $UUFILE` $DIRNAME.
- for i in *.??
- do
- echo "mailing $i"
- /usr/ucb/mail -s "$i" $2 < $i
- done
- echo "cleaning up"
- rm -rf $ZFILE $UUFILE $SPLITDIR
- fi
- exit 0
-